<?php
	$tmp = explode('.',$_SERVER['SERVER_NAME']);
	if(strstr($_SERVER['HTTP_HOST'],':')){
		$tmp2 = explode(':',$_SERVER['HTTP_HOST']);
		
		$port=':'.$tmp2[1];
	}else{
		$port ='';
	}
	if($tmp[2]){//www.rr2222.com
	 define('SITE_DOMAIN', $tmp[1].'.'.$tmp[2] );		
	}else{//rr2222.com
	 define('SITE_DOMAIN', $tmp[0].'.'.$tmp[1] );		
	}

			
	header("Location: http://wap.".SITE_DOMAIN.$port."/");
?>